<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$member=pdo_get('jy_mjicai_member',array('merchid'=>$_SESSION['onemerchid'],'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
if($_RQ['op']=='get'){
	$type=$_RQ['type'];
	$feetype=$this->setting['bufee_type']?:3;
	if($type){
		$return['feetitle']=$this->credit_type[$feetype];
		$return['credit_rate']=$paysetting['credit'.$feetype.'_rate']?:1;
	}
	$redfee=$this->fenxiaoset['xiao_beifee']+$this->fenxiaoset['xiao_jiafee'];
	$tips='倍财金变现拼中红包比例:'.$this->fenxiaoset['xiao_beifee'].'元倍财金+'.$this->fenxiaoset['xiao_jiafee'].'元加速金=兑换成'.$redfee.'元的拼中红包';
	if($member['baofee']<$this->fenxiaoset['xiao_beifee']){
		$tips1='当前倍财金不足￥'.$this->fenxiaoset['xiao_beifee'].'。不能兑换！';
	}
	if($member['jiafee']<$this->fenxiaoset['xiao_jiafee']){
		$tips2='当前加速金不足￥'.$this->fenxiaoset['xiao_jiafee'].'。不能兑换！';
	}
	$getdetail=$this->model('member')->getdetail();
	$return['item']=array_merge($getdetail,$member);
	$return['redfee']=$redfee;
	$return['item']['type']=$type;
	$return['tips']=$tips;
	$return['tips1']=$tips1;
	$return['tips2']=$tips2;
	set_html('title','兑换红包');
	exi($return);
}
if($_RQ['op']=='recharge'){
	if($member['baofee']<=0 || $member['baofee']<$this->fenxiaoset['xiao_beifee']){
		exi('当前倍财金不足￥'.$this->fenxiaoset['xiao_beifee'].'。不能兑换！','error');
	}
	if($member['jiafee']<=0 || $member['jiafee']<$this->fenxiaoset['xiao_jiafee']){
		exi('当前加速金不足￥'.$this->fenxiaoset['xiao_jiafee'].'。不能兑换！','error');
	}
	$redfee=$this->fenxiaoset['xiao_beifee']+$this->fenxiaoset['xiao_jiafee'];
	$this->model('licai')->duiredfee($redfee);
	exi('兑换成功！');
}